home *** CD-ROM | disk | FTP | other *** search
/ Enter 2003: The Beautiful Scenery / enter-parhaat-2003.iso / files / frendz.exe / frendz.dcr / Scripts_48_Main Script.ls < prev    next >
Encoding:
Text File  |  2002-12-31  |  3.2 KB  |  111 lines

  1. on playHolidayReminder flashSpriteNum, whichOne, daysLeft, doUpdateStage
  2.   daysLeft = max(daysLeft, 0)
  3.   doSetVar = 1
  4.   doShowDays = 1
  5.   case whichOne of
  6.     1:
  7.       frameName = "Default"
  8.       doSetVar = 0
  9.     2:
  10.       frameName = "Thanksgiving"
  11.       varStr = "Thanksgiving"
  12.       var2Str = "Don't be a turkey, call your friends and loved ones."
  13.     3:
  14.       frameName = "Father"
  15.       varStr = "Father's Day"
  16.       var2Str = "Be sure to call your loved ones."
  17.     4:
  18.       frameName = "Mother"
  19.       varStr = "Mother's Day"
  20.       var2Str = "Remember to call that special lady!"
  21.     5:
  22.       frameName = "Fourth"
  23.       varStr = "July 4th"
  24.       var2Str = "Call your friends and celebrate!"
  25.     6:
  26.       frameName = "Winter"
  27.       varStr = "Happy Holidays"
  28.       var2Str = "Stay warm by talking to your friends and loved ones."
  29.       doShowDays = 0
  30.   end case
  31.   if doShowDays then
  32.     if daysLeft = 0 then
  33.       varStr = "Today is" && varStr
  34.     else
  35.       if daysLeft = 1 then
  36.         varStr = "Tomorrow is" && varStr
  37.       else
  38.         varStr = "Only" && daysLeft && "days until" && varStr
  39.       end if
  40.     end if
  41.   end if
  42.   varStr = varStr & "." & RETURN & var2Str
  43.   if doSetVar then
  44.     setVariable(sprite(flashSpriteNum), frameName, varStr)
  45.   end if
  46.   sprite(flashSpriteNum).goToFrame(frameName)
  47.   if doUpdateStage then
  48.     updateStage()
  49.   end if
  50.   sprite(flashSpriteNum).play()
  51. end
  52.  
  53. on decDateIndex d, num, monthDays
  54.   theDay = d mod 100
  55.   theMonth = d / 100 mod 100
  56.   theYear = d / 10000
  57.   theDay = theDay - num
  58.   if theDay < 1 then
  59.     theMonth = theMonth - 1
  60.     if theMonth < 1 then
  61.       theMonth = theMonth + 12
  62.       theYear = theYear - 1
  63.     end if
  64.     theDay = theDay + monthDays[theMonth]
  65.   end if
  66.   theDate = (theYear * 10000) + (theMonth * 100) + theDay
  67.   return theDate
  68. end
  69.  
  70. on chooseHolidayReminder flashSpriteNum
  71.   holNameList = ["Default", "Thanksgiving", "Father", "Mother", "Fourth", "Winter"]
  72.   defList = []
  73.   thanksList = [20021128, 20031127, 20041125]
  74.   fatherList = [20020616, 20030615, 20040620]
  75.   motherList = [20020512, 20030511, 20040509]
  76.   julyList = [20020704, 20030704, 20040704]
  77.   holidayList = [20021231, 20031231, 20041231]
  78.   holDateList = [defList, thanksList, fatherList, motherList, julyList, holidayList]
  79.   holRangeList = [0, 13, 13, 13, 13, 30]
  80.   monthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  81.   dateIndex = getDateIndex()
  82.   whichOne = 1
  83.   daysLeft = 0
  84.   numHolidays = holNameList.count()
  85.   repeat with i = 1 to numHolidays
  86.     thisHoliday = holDateList[i]
  87.     numThis = thisHoliday.count()
  88.     repeat with j = 1 to numThis
  89.       lastDate = thisHoliday[j]
  90.       firstDate = decDateIndex(lastDate, holRangeList[i], monthDays)
  91.       put holNameList[i] && firstDate && lastDate
  92.       if (dateIndex >= firstDate) and (dateIndex <= lastDate) then
  93.         whichOne = i
  94.         repeat while 1
  95.           if dateIndex >= lastDate then
  96.             exit repeat
  97.             next repeat
  98.           end if
  99.           daysLeft = daysLeft + 1
  100.           lastDate = decDateIndex(lastDate, 1, monthDays)
  101.         end repeat
  102.         exit repeat
  103.       end if
  104.     end repeat
  105.     if whichOne <> 1 then
  106.       exit repeat
  107.     end if
  108.   end repeat
  109.   playHolidayReminder(flashSpriteNum, whichOne, daysLeft, 0)
  110. end
  111.